package exercises.Charpter8;

import static net.mindview.util.Print.print;
import polymorphism.music.Note;

class Piano extends Wind {
	void play(Note n) { print("Piano.play() " + n); }
	public String toString() { return "Piano"; }
}	

public class Seven {
	public static void tune(Instrument i) {
	    // ...
	    i.play(Note.MIDDLE_C);
	  }
	  public static void tuneAll(Instrument[] e) {
	    for(Instrument i : e)
	      tune(i);
	  }	
	  public static void main(String[] args) {
		    // Upcasting during addition to the array:
		    Instrument[] orchestra = {
		      new Wind(),
		      new Percussion(),
		      new Stringed(),
		      new Brass(),
		      new Woodwind(),
		      new Piano(),
		    };
		    tuneAll(orchestra);
		  }
}
